#include "userApp.h"
#include "debug.h"
#include "MKPBSO6212D_010X_Init.h"
#include "algorithm.h"

sLightSensorData_t g_lightSensorData = { 0 };


static void AppStart(void)
{
	int ret = MKPBSO6212D_010X_Init();
	p_dbg("MKPBSO6212D_010X_Init ret=%d", ret);
	
	while(1)
	{
		HAL_Delay(55);
		ret = GetSensorDataValue(&g_lightSensorData);
		if(ret == -1 )
		{
			p_dbg("tick:%d,get lightsensor value error!", HAL_GetTick());
		}
		else
		{
			p_dbg("tick:%d, C=%u, R=%u, G=%u, B=%u, IR=%u, lux=%lf", 
				HAL_GetTick(), 
				g_lightSensorData.C_Value, 
				g_lightSensorData.R_Value, 
				g_lightSensorData.G_Value,
				g_lightSensorData.B_Value,
				g_lightSensorData.IR_Value,
				LighitSensor_GetLux(&g_lightSensorData));
		}
	}
}


AppStruct AppStructure = 
{
	AppStart,
};
